const Koa = require('koa')
const app = new Koa()

// use方法就是注册使用第三方的插件/功能函数
app.use(async (ctx, next) => {
	const time = new Date()
	ctx.body = `<h1>1-start</h1>`
	await next() //
	const t = new Date() - time
	ctx.body += `<h1>1-end : ${t}ms </h1>`
})

app.use(async (ctx, next) => {
	ctx.body += `<h1>2-start</h1>`
	await next() //
	ctx.body += '<h1>2-end</h1>'
})

app.use(async (ctx, next) => {
	ctx.body += `<h1>3-start</h1>`
	await next() //
	ctx.body += '<h1>3-end</h1>'
})

app.listen(8000, () => {
	console.log(`http://localhost:8000`)
})
